From f9a964edde4011adf88902018cbb87723d78d0a2 Mon Sep 17 00:00:00 2001
From: Joel Carlson <JoelsonCarl@gmail.com>
Date: Wed, 20 Jun 2018 14:35:13 -0600
Subject: [PATCH 1/1] cmocka cmake: fix stack protect check

The cmake check for if -fstack-protect is supported needs to use
CMAKE_REQUIRED_FLAGS and not CMAKE_REQUIRED_DEFINITIONS.

Signed-off-by: Joel Carlson <JoelsonCarl@gmail.com>
---
Upstream status: submitted to cmocka mailing list

 cmake/Modules/CheckCCompilerFlagSSP.cmake | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/cmake/Modules/CheckCCompilerFlagSSP.cmake b/cmake/Modules/CheckCCompilerFlagSSP.cmake
index 2fe4395..ed34eb3 100644
--- a/cmake/Modules/CheckCCompilerFlagSSP.cmake
+++ b/cmake/Modules/CheckCCompilerFlagSSP.cmake
@@ -19,8 +19,8 @@
 include(CheckCSourceCompiles)
 
 function(CHECK_C_COMPILER_FLAG_SSP _FLAG _RESULT)
-   set(SAFE_CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS}")
-   set(CMAKE_REQUIRED_DEFINITIONS "${_FLAG}")
+   set(SAFE_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
+   set(CMAKE_REQUIRED_FLAGS "${_FLAG}")
    check_c_source_compiles("int main(int argc, char **argv) { char buffer[256]; return buffer[argc]=0;}" ${_RESULT})
-   set(CMAKE_REQUIRED_DEFINITIONS "${SAFE_CMAKE_REQUIRED_DEFINITIONS}")
+   set(CMAKE_REQUIRED_FLAGS "${SAFE_CMAKE_REQUIRED_FLAGS}")
 endfunction(CHECK_C_COMPILER_FLAG_SSP)
-- 
2.7.4

